package com.dotflat.fin.PO;

import com.dotflat.fin.dto.AppPayResult;
import com.dotflat.rest.PO.AreableObjectBasePO;
import com.dotflat.rest.utils.QueryInField;
import com.dotflat.rest.utils.RangeField;
import com.dotflat.rest.utils.ReadonlyField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;

import javax.persistence.Column;
import java.util.Date;
import java.util.List;

/**
 * 支付记录
 */

@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel
public class PayRecordPO extends AreableObjectBasePO {

    @ApiModelProperty("创建时间查询左值，大于等于这个值")
    @ReadonlyField
    @RangeField(value = "created")
    private Date createdL;

    @ApiModelProperty("创建时间查询右值，小于这个值")
    @ReadonlyField
    @RangeField(value = "created", operator = '<', eq = false)
    private Date createdR;

    @ApiModelProperty("班级id")
    private String classId;

    @ApiModelProperty("宝宝名称")
    private String childName;

    @ApiModelProperty("账单id,可能存在多个record对象对应一个order对象")   //可能存在多个record对象对应一个order对象
    private String payOrderId;

    @ApiModelProperty(value = "支付id查询的集合")
    @ReadonlyField
    @JsonIgnore
    @QueryInField("payOrderId")
    private List<String> payOrderIds;

    @ApiModelProperty("收费账号")
    private String payAccountId;

    @ApiModelProperty("银行流水号")
    private String serialNumber;

    @ApiModelProperty("需要扣减的定金")
    private Long useDeposit;

    @ApiModelProperty("已支付金额")
    private Long paiedMoney;

    @ApiModelProperty("实付类型:alipay,wechat")
    private String payType;

    @ApiModelProperty("支付状态1:未付款;2:已付款,3:支付中")
    private Integer payStatus;

    @ApiModelProperty("支付成功时间查询左值，大于等于这个值")
    @ReadonlyField
    @RangeField(value = "payTime")
    private Date payTimeL;

    @ApiModelProperty("支付成功时间查询右值，小于这个值")
    @ReadonlyField
    @RangeField(value = "payTime", operator = '<', eq = false)
    private Date payTimeR;

    @ApiModelProperty("总金额")
    private Double totalFee;

    @ApiModelProperty(hidden = true)
    private FinPlanOrderPO payOrder;

    @ApiModelProperty("班级名称")
    private String className;

    @ApiModelProperty("支付流水号")
    private String payId;

    @Type(type = "json")
    @ApiModelProperty("支付结果")
    private AppPayResult payResult;
}
